#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
void xierpaixu(int* a, int n)
{
	int gap = n;
	while (gap > 1)
	{
		gap = gap / 3 + 1;
		for (int i = 0; i < n - gap; i++)
		{
			int key = i;
			int tmp = a[key + gap];
			while (key >= 0)
			{
				if (tmp < a[key])
				{
					a[key + gap] = a[key];
					key=key-gap;
				}
				else
				{
					break;
				}
			}
			a[key + gap] = tmp;
		}
	}
}
int main()
{
	int a[] = { 234,5436,7,568,478,679,878,97,98,0,90,0,8,543,51,346,54,6754,7,24657,265 };
	xierpaixu(a, sizeof(a) / sizeof(a[0]));
	for (int i = 0; i < sizeof(a) / sizeof(a[0]); i++)
	{
		printf("%d ", a[i]);
	}
	return 0;
}